//
//  AppDelegate+JwProject.m
//  JwPack
//
//  Created by 陈警卫 on 2022/8/31.
//

#import "AppDelegate+JwProject.h"

#import "JwMacro.h"
#import "JwCore.h"
#import "JwCate.h"
#import "JwSingle.h"
#import "JwExten.h"

#import "JwFrame.h"
#import "JwGeneral.h"

#import "UIColor+JwPack.h"

#import "JwHomeController.h"
#import "JwDiscoverController.h"
#import "JwMeController.h"

@implementation AppDelegate (JwProject)

- (void)setupApp {
    
    [JwSkiner shared];
    [JwLanguager shared];
    
    kJwSkiner.colorClass = [UIColor class];
    kJwLanguager.languageName = @"JwLocalizable";
    kJwLanguager.languageCans = @[@"en", @"zh-Hans"];
    
    kJwWeak(self);
    self.window.jw_didSkinerBlock = ^(id  _Nonnull sender) {
        [wself setupJwPackGV];
    };
}

- (void)setupJwPackGV {
    // Frame
    GV_JwFrame_backColorString = [UIColor jw_back].value;
    GV_JwFrame_navBarBackColorString = [UIColor jw_navBarBack].value;
    GV_JwFrame_navBarTintColorString = [UIColor jw_navBarTint].value;
    GV_JwFrame_tabTintColorString = [UIColor jw_tabTint].value;
    GV_JwFrame_tabSelColorString = [UIColor jw_tabSel].value;
    GV_JwFrame_tabUnSelColorString = [UIColor jw_tabUnSel].value;
    
    GV_JwProgressHUD_backColorString = [UIColor jw_mudo].value;
    GV_JwProgressHUD_tintColorString = [UIColor jw_title].value;
}

- (void)setupRootViewController {
    NSMutableArray *tbModels = [NSMutableArray array];
    
    JwHomeController *homeVC = [[JwHomeController alloc] init];
    JwTabBarModel *homeModel = [JwTabBarModel modelWithVC:homeVC
                                             tabImageName:@"tab_myebike"
                                                    title:@"ui_tabbar_home"];
    
    JwDiscoverController *discoverVC = [[JwDiscoverController alloc] init];
    JwTabBarModel *discoverModel = [JwTabBarModel modelWithVC:discoverVC
                                                 tabImageName:@"tab_discover"
                                                        title:@"ui_tabbar_discover"];
    
    JwMeController *meVC = [[JwMeController alloc] init];
    JwTabBarModel *meModel = [JwTabBarModel modelWithVC:meVC
                                           tabImageName:@"tab_me"
                                                  title:@"ui_tabbar_me"];
    
    [tbModels addObject:homeModel];
    [tbModels addObject:discoverModel];
    [tbModels addObject:meModel];
    
    JwRootViewController *rc = [JwRootViewController rootWithTabBarModels:tbModels];
    self.window.rootViewController = rc;
}


@end
